/**
 * 设置“实时清粉“
 */
import { Service } from '@gnlab/utils'
import type { Services } from '@/services'
import { API } from '@/services/common/api'

export class AutoClearContacts extends Service<Services> {
  async get() {
    return API('/Config/GetConfig', {
      formatter(raw: { IsAutoDeleteContact: boolean | null }) {
        return raw.IsAutoDeleteContact === true
      },
    })
  }

  async save(enable: boolean) {
    return API('/Config/SaveIsAutoDeleteContact', {
      data: { IsAutoDeleteContact: enable },
      formatter() {},
    })
  }
}
